<!DOCTYPE HTML>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no,email=no,date=no,aItemress=no">
	<title>确认订单</title>
	<link rel="stylesheet" type="text/css" href="../../css/aui.css" />
	<link rel="stylesheet" type="text/css" href="../../css/aui-flex.css" />
	<link rel="stylesheet" type="text/css" href="../../css/app.css" />
	<style type="text/css">
		.list-item {
			padding: 0 0.75rem;
			background-color: #FFFFFF;
			height: 4.9rem;
			display: flex;
			-webkit-box-orient: horizontal;
			-webkit-box-direction: normal;
			-webkit-flex-direction: row;
			flex-direction: row;
			justify-content: space-between;
			-webkit-box-align: center;
			-webkit-align-items: center;
			align-items: center;
		}

		.list-item-2 {
			/*padding: 0.7rem 0.5rem;*/
			background-color: #FFFFFF;
			margin-bottom: 0.5rem;
			height: 4.5rem;
			display: flex;
			-webkit-box-orient: horizontal;
			-webkit-box-direction: normal;
			-webkit-flex-direction: row;
			flex-direction: row;
			justify-content: space-between;
			-webkit-box-align: center;
			-webkit-align-items: center;
			align-items: center;
		}

		.list-item .location-icon {
			width: 1.2rem;
		}

		.list-item-2 .location-icon {
			width: 1.2rem;
			display: inline-block;
		}

		.list-item .pay-channel {
			flex: 1;
			/*margin-left: 0.8rem;*/
		}

		.list-item-2 .pay-channel {
			flex: 1;
			/*margin-left: 0.8rem;*/
		}

		.list-item .btn-right {
			position: absolute;
			width: 1rem;
			right: 0.65rem;
			margin-top: -0.4rem
		}

		.list-item-2 .btn-right {
			width: 1rem;
		}

		.list-item .ming-text-hui {
			height: 1.5rem;
			line-height: 0.75rem;
			margin-top: 0.4rem;
		}

		.goods-list .aui-list .aui-list-item {
			padding-left: 0rem !important;
		}

		.goods-list header {
			color: #72D5EF !important;
			font-size: 0.85rem;
			border-left: 0.2rem solid #690078;
			height: 0.85rem;
			line-height: 0.85rem;
			padding-left: 0.35rem;
		}

		.goods-list .aui-list .aui-list-item-media {
			display: inline-block;
			width: 3.2rem !important;
			margin-top: .8rem;
			padding: 0 !important;
		}

		.goods-list .aui-list .aui-list-item-media img {
			/*border-radius: 0.25rem;*/
			display: inline-block;
			width: 3.2rem;
			height: 3.2rem;
		}

		.goods-list .aui-list .aui-list-item-title {
			/*height: 1.7rem;*/
			padding-top: .1rem;
			font-size: .7rem;
			font-family: PingFangSC-Regular;
			font-weight: 400;
			color: rgba(50, 50, 51, 1);
			line-height: .85rem;
		}

		.goods-list .aui-list .aui-list-item-text {
			margin-top: 0.35rem;
			padding-bottom: 0.5rem;
			padding-left: .6rem !important;
		}

		.goods-list .aui-list .aui-list-item-inner {
			padding-right: 0;
		}

		.list-info .aui-list-item-title {
			font-size: 0.7rem;
		}

		.list-info img {
			width: 1.1rem;
			display: inline-block;
			vertical-align: middle;
		}

		.list-info .icon-switch {
			width: 1.7rem;
		}

		.list-info .aui-list .aui-list-item {
			padding-left: 0.75rem !important;
			margin-right: 0.75rem;
			background-position: 0.5rem bottom;
		}

		.list-info .aui-list .aui-list-item-inner {
			padding-right: 0rem !important;
		}

		.list-info .aui-list-item-arrow:before {
			right: 0.1rem;
		}

		.list-info>ul>li {
			/*border:1px solid red!important;*/
			height: 2.45rem !important;
		}

		textarea::placeholder {
			font-size: .75rem;
			font-family: PingFangSC-Regular;
			font-weight: 400;
			color: rgba(153, 153, 153, 1);
		}

		textarea::-webkit-input-placeholder {
			font-size: .75rem;
			font-family: PingFangSC-Regular;
			font-weight: 400;
			color: rgba(153, 153, 153, 1);
		}

		input::-webkit-input-placeholder,
		textarea::-webkit-input-placeholder {
			color: #999999;
			font-size: .7rem;
		}

		.margin-l-5 {
			margin-left: .5rem;
		}

		.margin-r-5 {
			margin-right: .5rem;
		}

		.color-666 {
			font-size: .75rem;
			font-family: PingFangSC-Regular;
			font-weight: 400;
			color: rgba(102, 102, 102, 1);
		}

		.color-333 {
			font-size: .75rem;
			font-family: PingFangSC-Regular;
			font-weight: 400;
			color: rgba(51, 51, 51, 1);
		}

		.can-use {
			font-size: .75rem;
			font-family: PingFangSC-Regular;
			font-weight: 400;
			color: rgba(114, 213, 239, 1) !important;
			display: inline-block;
			margin-right: .5rem;
		}

		.good_detail_head {
			padding-top: 1rem;
			padding-bottom: 0.5rem;
			padding: .75rem;
			font-size: .85rem;
			font-family: PingFangSC-Semibold;
			font-weight: 600;
			color: rgba(51, 51, 51, 1);
		}

		.good_detail_head img {
			display: inline-block;
			width: .2rem;
			height: .7rem;
			margin-right: .25rem;
		}

		.score_disco {
			width: 100%;
			padding: .75rem .75rem;
			display: flex;
			flex-direction: column;
			font-size: .75rem;
			font-family: PingFangSC-Regular;
			font-weight: 400;
			color: rgba(102, 102, 102, 1);
			line-height: 1.05rem;
			background-color: #fff;
		}

		.score_status1 {}

		#score_symbol {
			display: inline-block;
			width: .85rem;
			height: .85rem;
			line-height: .95rem;
			text-align: center;
			color: #fff;
			border-radius: 50%;
			background: linear-gradient(135deg, rgba(132, 229, 255, 1) 0%, rgba(107, 180, 255, 1) 100%, rgba(122, 174, 229, 1) 100%) !important;
		}

		.score_opt img {
			width: 2.25rem;
			height: 1.5rem;
			float: right;
		}

		.score_none {
			display: inline-block;
			float: right;
			font-size: .75rem;
			font-family: PingFangSC-Regular;
			font-weight: 400;
			color: rgba(51, 51, 51, 1);
		}

		.bill_disco {
			height: 2.45rem;
			width: 100%;
			padding: .75rem .75rem;
			font-size: .75rem;
			font-family: PingFangSC-Regular;
			font-weight: 400;
			color: rgba(102, 102, 102, 1);
			background-color: #fff;
		}

		.receiptDetail .bill_disco {
			height: 2.45rem;
			width: 100%;
			padding: .75rem 0;
			font-size: .75rem;
			font-family: PingFangSC-Regular;
			font-weight: 400;
			color: rgba(102, 102, 102, 1);
			float: left;
			border-bottom: 0.05rem solid #F0F1F2
		}

		.bill_type {
			display: inline-block;
			float: right;
			font-size: .75rem;
			font-family: PingFangSC-Regular;
			font-weight: 400;
			color: rgba(51, 51, 51, 1);
			margin-right: 0;
		}

		.bill_type img {
			display: inline-block;
			margin-left: .3rem;
			margin-bottom: .1rem;
		}

		.subtotal {
			display: flex;
			flex-direction: column;
			width: 100%;
			padding: .6rem .75rem;
			font-size: .75rem;
			font-family: PingFangSC-Regular;
			font-weight: 400;
			color: rgba(102, 102, 102, 1);
			line-height: 1.45rem;
			background-color: #fff;
		}

		.subtotal>div {
			flex: 1;
			display: flex;
		}

		.subtotal>div>span:nth-child(1) {
			flex: 1;
			text-align: left;
		}

		.subtotal>div>span:nth-child(2) {
			flex: 1;
			text-align: right;
			font-size: .75rem;
			font-family: Akrobat-Bold;
			font-weight: bold;
			color: rgba(51, 51, 51, 1);
		}

		.remarks {
			/*height:5.3rem;*/
			width: 100%;
			padding: .7rem .75rem;
			font-size: .75rem;
			font-family: PingFangSC-Regular;
			font-weight: 400;
			color: rgba(102, 102, 102, 1);
			background-color: #fff;
			margin-bottom: 2rem;
			float: left;
		}

		.remarks>textarea {
			min-height: 4rem;
			margin-top: .4rem;
			background: rgba(250, 250, 250, 0.4);
			border-radius: 0.2rem;
			border: 0.05rem solid rgba(204, 204, 204, 0.4);
			padding: 0.2rem
		}

		.coupon_express {
			height: 2.3rem;
			width: 100%;
			padding: 0 .75rem;
			display: flex;
			flex-direction: column;
			font-size: .75rem;
			line-height: 2.45rem;
			font-family: PingFangSC-Regular;
			font-weight: 400;
			color: rgba(102, 102, 102, 1);
			background-color: #fff;
		}

		.coupon {
			flex: 1;
			border-bottom: 1px solid rgba(238, 238, 238, .5);
		}

		.coupon>span {
			display: inline-block;
			float: right;
			margin-right: 0;
			color: #005A93
		}

		.coupon img {
			display: inline-block;
			width: .4rem;
			height: .7rem;
			/*margin-left:.3rem;*/
			margin-bottom: .1rem;
		}

		.express {
			flex: 1;
			display: flex;
		}

		.express>span:nth-child(1) {
			flex: 1;
			text-align: left;
		}

		.express>span:nth-child(2) {
			flex: 1;
			text-align: right;
			font-size: 15px;
			font-family: PingFangSC-Regular;
			font-weight: 400;
			color: rgba(51, 51, 51, 1);
		}
		/*改写*/

		.all_order_item_title {
			height: 2.2rem;
			display: flex;
			align-items: center;
			margin: 0 0.75rem;
			line-height: 2.2rem;
			border-bottom: 0.05rem solid rgba(238, 238, 238, 0.5);
		}

		.all_order_item {
			padding: 0.8rem 0 0.85rem 0;
			margin-left: 0.8rem;
			margin-right: 0.8rem;
			border-bottom: 0.05rem solid rgba(238, 238, 238, 0.5);
		}

		.all_order_item>div {
			display: flex;
		}

		.info-name {
			height: 1.95rem;
			margin-bottom: 0.25rem;
		}

		.info-name>div:nth-child(1) {
			font-size: 0.7rem;
			font-family: PingFangSC-Regular;
			font-weight: 400;
			color: rgba(50, 50, 51, 1);
			width: 13.35rem;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}

		.info-name>div:nth-child(2) {
			font-size: 0.6rem;
			font-family: PingFangSC-Regular;
			font-weight: 400;
			color: rgba(153, 153, 153, 1);
		}

		.info-price {
			display: flex;
			justify-content: space-between;
			align-items: center;
			width: 100%;
		}

		.info-price>div:nth-child(1) {
			font-size: 0.75rem;
			font-family: PingFangSC-Medium;
			font-weight: 500;
			color: rgba(51, 51, 51, 1);
		}

		.info-price>div:nth-child(2) {
			font-size: 0.6rem;
			font-family: PingFangSC-Regular;
			font-weight: 400;
			color: rgba(153, 153, 153, 1);
		}

		.info-shop {
			width: 13.35rem;
			box-sizing: border-box;
		}

		.headIcon {
			width: .15rem;
			height: .75rem;
			background: linear-gradient(360deg, rgba(167, 233, 255, 1) 0%, rgba(0, 90, 147, 1) 100%);
			display: inline-block;
			margin-right: 0.4rem;
		}

		.aui-flex-col .content {
			font-size: 0.85rem;
			font-weight: bold;
		}

		.aui-flex-col .detail {
			font-size: 0.6rem;
		}

		.text-info {
			height: 1.3rem;
			line-height: 1.3rem;
			padding-right: 1rem;
			font-size: .7rem;
			font-weight: 500;
			color: rgba(50, 50, 51, 1);
			display: inline-block;
		}

		.items {
			float: left;
			padding: 0 0.2rem;
			margin-top: -0.1rem
		}

		.detiail_address {
			width: 80%;
			margin-top: 0.1rem;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}

		.receiptDetail {
			background: #fff;
			width: 100%;
			float: left;
			margin-bottom: 0.5rem;
			padding: 0 0.75rem;
			box-sizing: border-box;
			padding-bottom: 0.5rem;
		}

		.item {
			padding: 0 0.5rem;
			float: left;
			width: 100%;
			box-sizing: border-box;
			height: 1.4rem;
			line-height: 1.4rem;
		}

		.item .title {
			font-size: 0.65rem;
			color: #808080;
			float: left;
		}

		.item .textInfo {
			font-size: 0.65rem;
			color: #2E2E2E;
			float: right;
		}

		.itemList {
			padding-top: 0.5rem;
			width: 100%;
			float: left;
		}

		.active {
			display: block;
		}
	</style>
</head>

<body>
	<div class="" id="app" v-cloak="">
		<div class="list-item-1" v-if="order_info.is_default_address=='1'" tapmode onclick="open_win('address_choice','address_choice.html',false)">
			<div class="list-item">
				<!-- 收件人信息 -->
				<div class="pay-channel">

					<div class="aui-flex-col">
						<div style="margin-top:.4rem">
							<img src="../../image/icon/place.png" style="display:inline-block;width:.9rem;height:.9rem;position:absolute;left:0.75rem;float:left;margin-top:-0.2rem">
							<span style="margin-left:1.1rem;font-size:0.8rem;display: inline-block;margin-top:-0.3rem;float:left">{{good_address.province_name}}
								{{good_address.city_name}}</span>
						</div>
						<div class="detiail_address"><span class="content"> {{good_address.area_name}}
								{{good_address.detailed_address}}</span></div>
						<div style="width:100%" class="detail">
							<span style="font-size:0.7rem">收件人：</span>
							<div class="text-info">
								{{good_address.username}}
							</div>
							<div class="text-info" style="margin-left:-0.3rem">
								{{good_address.mobile}}
							</div>
						</div>

					</div>


					<!-- <div class="aui-flex-col">

							<div style="display:inline-block;height:1.3rem;line-height:1.3rem;padding-right:1rem;font-size:.75rem;font-family:PingFangSC-Medium;font-weight:500;color:rgba(50,50,51,1);">
								{{good_address.username}}
							</div>
							<div class="aui-text-left" style="display:inline-block;height:1.3rem;line-height:1.3rem;font-size:.75rem;font-family:PingFangSC-Medium;font-weight:500;color:rgba(50,50,51,1);">
								{{good_address.mobile}}
							</div>
						</div>
						<div class="aui-ellipsis-2" style="font-size:.7rem;font-family:PingFangSC-Regular;font-weight:400;color:rgba(100,100,102,1);">
							收货地址：{{good_address.province_name}} {{good_address.city_name}} {{good_address.area_name}} {{good_address.detailed_address}}
						</div> -->
				</div>
				<div>
					<img class="btn-right" src="../../image/btn/btn-right.png" />
				</div>
			</div>

			<div>
				<img src="../../image/bg/bg-line.png" />
			</div>
			<div class="lh10"></div>
		</div>
		<div class="list-item-2" v-if="order_info.is_default_address=='0'" tapmode onclick="open_win('address_new','../my/address_new.html',false)">
			<div style="display:inline-block;width:100%;">
				<img src="../../image/icon/place.png" style="display:inline-block;width:.9rem;height:.9rem;position:absolute;left:50%;margin-left:-0.45rem;top:1.2rem">
				<div class="aui-text-center pay-channel" style="display:inline-block;width:100%;padding-top:1rem;font-size:.75rem;font-family:PingFangSC-Medium;font-weight:500;color:rgba(102,102,102,1);position:relative;">
					<span style="margin-top:1.8rem;display: inline-block;color:#B3B3B3">你还没有收货地址，点击这里添加</span>
					<img src="../../image/btn/btn-right-s.png" style="display:inline-block;width:.3rem;height:.7rem;position:absolute;right:.75rem;bottom:.8rem;">
				</div>
				<div style="display:inline-block;width:100%;">
					<img src="../../image/bg/bg-line.png" style="display:inline-block;width:100%;" />
				</div>
			</div>
		</div>

		<div class="goods-list ming-bg-white" style="none">
			<!-- 商品信息头部 -->
			<div class="aui-border-b good_detail_head">
				<!-- <img src="../../image/icon/lines.png">商品信息 -->
				<span class="headIcon"></span><span class="head_text">商品信息</span>
			</div>
			<!-- 商品信息内容 -->
			<div class="all_order_item" style="padding:0;border-bottom:0;">
				<div v-for="(vo,index) in goods_info" style="padding:.8rem 0;border-bottom: 0.05rem solid rgba(238, 238, 238, 0.5) !important;">
					<!-- 商品图 -->
					<div class="" style="margin-right:0.6rem;">
						<img :src="vo.cover" style="display:block;width:3.2rem;border-radius:0.2rem;flex-shrink:0" />
					</div>

					<!-- 商品价位 -->
					<div class="info-shop">
						<div class="info-name">
							<div>{{vo.title}}</div>
							<div v-if="item.length>0" v-for="item in vo.good_sku" class="" style="align-items:center;height:0.9rem;background:#E3F4FF;color:#005A93;font-size:0.6rem;border-radius:0.2rem;padding:0.1rem 0;margin-top:0.1rem;float: left;">
								<div class="items">{{item}}</div>
							</div>
						</div>
						<div class="info-price">
							<div><span class="" style="float:left;color:#E90000">
								{{vo.cost_price}}积分
									<!-- ￥{{price_format('yuan',vo.cost_price)}}.{{price_format('fen',vo.cost_price)}} -->
							</div>
							<div>×{{vo.good_num}}</div>
						</div>
					</div>
				</div>
			</div>

		</div>

		<div class="list-info" style="margin-top:.5rem;">
			<!-- 优惠券 -->
			<div class="coupon_express">

				<div class="express" style="border-bottom:0.05rem solid #F0F1F2;">
					<span>配送方式</span>
								<span>快递</span>
							</div>

						</div>
						<div class="lh10"></div>





						<!-- 商品小计 -->
						<div class="subtotal">
							<div style="border-bottom:0.05rem solid #F0F1F2;padding:0 0 0.46rem"><span>商品小计</span><span style="font-size:0.75rem;font-family:Akrobat-Bold ;color:rgba(51,51,51,1);">{{total}}积分</span>
							</div>


							<div style="border-bottom:0.05rem solid #F0F1F2;padding:0.46rem 0"><span>运费</span><span style="font-size:0.75rem;font-family:Akrobat-Bold ;color:rgba(51,51,51,1);">￥{{order_info.exp_fee}}</span>
							</div>

						</div>
						<div class="lh10"></div>

						<!-- 金币抵扣 -->
						<div class="score_disco">
							<div class="score_status1" style="float:left;">
								<div style="margin-top:0.3rem;float:left">
									<span style="float:left">积分兑换，</span>
									<div v-if="" class="" style="font-size:0.75rem;font-family:PingFangSC-Regular;font-weight:400;color:rgba(102,102,102,1);float: left;">
										可用{{score}}积分
									</div>
								</div>


							</div>

						</div>
						<div v-if="" class="lh10">&nbsp;</div>


					</div>

					<!-- 备注留言 -->
					<div class="remarks">
						备注留言
						<textarea max_length="150" v-model="mark" placeholder="在此填写备注，最多150个字" class="textareaBox"></textarea>
					</div>
				</div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/vue.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script>
	var vm = new Vue({
		el: "#app",
		data: {
			id: 0,
			flag: 0, //2标识详情页发起生成订单，1标识购物车发起生成订单，3秒杀，4团购
			goods_info: [],
			order_info: {
				is_used_score: 0
			}, //is_used_score是否可使用商城币，score商城币，score_money抵扣金额
			good_address: {},
			coupon_txt: '暂无可用',
			coupon_money: 0,
			shipping_remark: '',
			is_used_score: 0,
			score: 0,
			score_money: 0,
			score_convert: 10,
			ship_price: 0,
			is_used_coupon: 0,
			user_coupon_id: 0,
			max_length: 150,
			mark: '',
			good_list: [], //[{"good_id":"1","good_num":"2","good_sku":"40寸|红"}]
			total: 0,
			miao_id: 0,
			tuan_id: 0,
			tuan_uid_pid: 0,
			is_receipt: 0,
			receipt_type: '未选择',
			receipt_person: '',
			receipt_name: '',
			receipt_num: '',
			currentCheck: true,
			current: false,
			total_amount: 0,
			sel_price: {},
			shipping_type: 1,
			sel_service: 0,
			sel_floor_name: '1楼',
			sel_floor: 1,
			shipping_list: {}
		},
		methods: {
			get_list: function() {
				// console.log(JSON.stringify({
				// 	token: $api.getStorage('token'),
				// 	good_list: JSON.stringify(vm.good_list),
				// 	flag: vm.flag
				// }))
				get_data('api/ScoreOrder/getCreateOrderInfo', {
					token: $api.getStorage('token'),
					good_list: JSON.stringify(vm.good_list),
					flag: vm.flag
				}, function(ret) {
					// alert(JSON.stringify(ret.data.exp_fee))
					if (ret.status) {
						vm.order_info = ret.data
						vm.total_amount = vm.total * 100 + ret.data.exp_fee
						if (ret.data.is_default_address == '1') {
							vm.good_address = ret.data.good_address
						}
						if (ret.data.is_user_coupon != '0') {
							vm.coupon_txt = ret.data.is_user_coupon + '张优惠券可用'
						}
						if (ret.data.is_used_score == '1') {
							vm.score = ret.data.score
							vm.score_money = ret.data.score_money / 100
								// vm.score_convert = ret.data.score_convert
						}
					}
				})
			},
			get_price: function() {
				get_data('api/Good/peisong', {
					token: $api.getStorage('token')
						// louceng:'1'
				}, function(ret) {
					// console.log(JSON.stringify(ret))
					if (ret.status) {
						vm.sel_price = ret.data[0]
					}
				})
			},
			get_shipping: function() {
				get_data('api/Good/shipping_list', {
					token: $api.getStorage('token')
						// louceng:'1'
				}, function(ret) {
					// alert(JSON.stringify(ret))
					if (ret.status) {
						vm.shipping_list = ret.data
					}
				})
			},
			price_format: function(type, price) {
				var status = (price + '').indexOf('.')
				if (status == '-1') {
					if (type == 'yuan') {
						return price;
					}
					if (type == 'fen') {
						return '00';
					}
				}
				var price_array = (price + '').split('.')
				if (type == 'yuan') {
					return price_array[0];
				}
				if (type == 'fen') {
					var price_fen = price_array[1].length < 2 ? price_array[1] + '0' : price_array[1];
					return price_fen;
				}
			},
		},

		watch: {


			order_info: function(new_str, old_str) {
				var amount = this.order_info.exp_fee;

				send_event('order_amount', {
					amount: amount,
					is_used_score:vm.order_info.is_used_score
				})
			},



			mark: function(a, b) {
				if (this.mark.length > 150) {
					this.mark = b;
				}
			},


		}
	})
	apiready = function() {
		vm.flag = $api.getStorage('flag')
		vm.good_list = $api.getStorage('goods_info').info
		console.log(JSON.stringify(vm.good_list))
		vm.goods_info = $api.getStorage('goods_info').info
		var total = 0
		vm.good_list.forEach(function(el, index) {
			vm.goods_info[index].good_sku = vm.good_list[index].good_sku.split('|')
			total += el.cost_price * el.good_num
		})
		vm.total = total
		vm.get_list()
		vm.get_price()


		// vm.get_shipping();

		if ($api.getStorage('miao_id')) {
			vm.miao_id = $api.getStorage('miao_id')
			$api.rmStorage('miao_id')
		}
		if ($api.getStorage('tuan_id')) {
			vm.tuan_id = $api.getStorage('tuan_id')
			$api.rmStorage('tuan_id')
		}
		if ($api.getStorage('tuaninfo')) {
			vm.tuan_id = $api.getStorage('tuaninfo').tuan_id
			vm.tuan_uid_pid = $api.getStorage('tuaninfo').id
			$api.rmStorage('tuaninfo')
		}
		add_event('address_choice', function(ret) {
			vm.good_address = ret.address
			vm.order_info.is_default_address = '1';
		})
		add_event('address_change', function(ret) {
			vm.get_list()
		})
		add_event('receipt_info', function(ret) {
			vm.receipt_type = ret.receipt_type
			vm.receipt_name = ret.receipt_name
			vm.receipt_num = ret.receipt_num
			vm.receipt_phone = ret.receipt_phone
			vm.receipt_address = ret.receipt_address
			vm.receipt_account = ret.receipt_account
			vm.receipt_bank = ret.receipt_bank
			vm.receipt_person = ret.receipt_person
		})
		add_event('receipt_select', function(ret) {
			vm.is_receipt = ret.receipt.id
			vm.receipt_type = ret.receipt.type
			vm.receipt_person = ret.receipt.person
			vm.receipt_name = ret.receipt.name
			vm.receipt_num = ret.receipt.num

		})

		add_event('no_receipt', function(ret) {
			vm.is_receipt = 0
			vm.receipt_person = ''
		})
		add_event('coupon_choice', function(ret) {
			console.log(JSON.stringify(ret))
			if (ret.coupon_id) {
				vm.is_used_coupon = 1;
				vm.user_coupon_id = ret.coupon_id
				vm.coupon_txt = '已使用1张优惠券'
				if (ret.money == 0) {
					vm.coupon_money = vm.order_info.exp_fee / 100;
				} else {
					vm.coupon_money = ret.money;
				}
				//

			}
		})
	};

	function createOrder() {
		// alert(vm.order_info.exp_fee)

		var data = {
			token: $api.getStorage('token'),
			address_id: vm.good_address.id,
			flag: vm.flag, //1标识详情页发起生成订单，2标识购物车发起生成订单
			score_price: vm.is_used_score == '1' ? vm.score_money : 0,
			score: vm.is_used_score == '1' ? vm.score : 0,
			// ship_price: vm.is_used_coupon == '0' ? vm.order_info.exp_fee : 0,
			ship_price: vm.order_info.exp_fee,
			// ship_price: vm.ship_price*100,
			shipping_remark: vm.shipping_remark,
			shipping_type: vm.shipping_type,
			is_used_coupon: vm.is_used_coupon,
			user_coupon_id: vm.user_coupon_id,
			good_list: JSON.stringify(vm.good_list), //[{"good_id":"1","good_num":"2","good_sku":"40寸|红"}]
			remark: vm.mark,
			receipt_type: vm.receipt_type == '未选择' ? '' : vm.receipt_type,
			receipt_name: vm.receipt_name,
			receipt_num: vm.receipt_num,
			receipt_phone: vm.receipt_phone,
			receipt_address: vm.receipt_address,
			receipt_account: vm.receipt_account,
			receipt_bank: vm.receipt_bank,
			receipt_person: vm.receipt_person,
			is_receipt: vm.is_receipt,
		}
		console.log(JSON.stringify(data))
			// return
		data.miao_id = 0;
		// alert(JSON.stringify(data))
		if (vm.miao_id != 'undefined') {
			data.miao_id = vm.miao_id
		}
		if (vm.tuan_id != 'undefined') {
			data.tuan_id = vm.tuan_id
		}
		if (vm.tuan_uid_pid != 'undefined') {
			data.tuan_uid_pid = vm.tuan_uid_pid
		}
		get_data('api/ScoreOrder/createOrder', data, function(ret) {
			// alert(JSON.stringify(ret))
			// toast(ret.msg)
			// alert(ret.msg)
			if (ret.status) {
				$api.rmStorage('receipt_info')
					//打开下一页
				$api.setStorage('orderinfo', {
						pay_price: ret.data.pay_price,
						order_num: ret.data.order_num,
						order_id: ret.data.order_id,
						flag: 5
					})
					//					购物车数据可能会变化

				//判断金额
				if (ret.data.pay_price == 0) {
					console.log(ret.data.order_id)
					get_data('payment/ScorePay/getOrderSign', {
						order_id: ret.data.order_id,
						order_type: ''
					}, function(ret) {

						if (ret.status) {
							if (ret.status == '99' && ret.msg == '订单处理成功') {
								pay_res(1);
								send_event('order_chang')
								setTimeout(function() {
									close_win()
								}, 1000)
								return;
							}
						}
					});
				} else {
					send_event('cart_ref')
					//2022年3月17日08:43:33 白
					open_win('payment_score', 'payment_score.html')
					setTimeout(function() {
						close_win()
					}, 1000)
				}
			} else {
				// toast(ret.msg)
				api.alert({
					title: '提示信息',
					msg: ret.msg,
				}, function(ret, err) {
					if (ret) {
						//  alert( JSON.stringify( ret ) );
					} else {
						//  alert( JSON.stringify( err ) );
					}
				});

			}
		})
	}

	function coupon_choice() {
		if (vm.order_info.is_user_coupon != '0') {
			open_win('coupon_choice', 'coupon_choice.html', false, {
				money: vm.total_amount
			})
		}
	}

	//支付结果通知
	function pay_res(res, orderinfo) {
		send_event('tuan_ref')
		$api.setStorage('pay_res', res)
		open_win('pay_score', 'pay_score.html', false)
	}
</script>

</html>
